home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc1_2_x / popupmen.sit / PopUpMenu 2.0b2 / card_4784.txt < prev    next >
Text File  |  1989-09-13  |  2KB  |  84 lines

  1. -- card: 4784 from stack: in.0b2
  2. -- bmap block id: 0
  3. -- flags: 4000
  4. -- background id: 3155
  5. -- name: 
  6. ----- HyperTalk script -----
  7. -----------------------------------------------------------------------
  8. -- openCard
  9. -----------------------------------------------------------------------
  10. on openCard
  11.   global h, v, disabled, fonts, fonts1, fonts2, fonts3, fonts4
  12.  
  13.   put "(Geneva,New York,Monaco,Chicago" into fonts1
  14.   put "Geneva,(New York,Monaco,Chicago" into fonts2
  15.   put "Geneva,New York,(Monaco,Chicago" into fonts3
  16.   put "Geneva,New York,Monaco,(Chicago" into fonts4
  17.  
  18.   put "Geneva,New York,Monaco,Chicago" into fonts
  19.  
  20.   put 4 into disabled
  21.   set the textFont of card button "Example" to item disabled of fonts
  22.  
  23.   get the rect of card button "Example"
  24.  
  25.   put (last item of it) + top of card window into v
  26.   put (first item of it) + left of card window + 1 into h
  27.  
  28.   pass openCard
  29. end openCard
  30.  
  31.  
  32. -----------------------------------------------------------------------
  33. -- doPopUp
  34. -----------------------------------------------------------------------
  35. on doPopUp
  36.   global h, v, disabled, fonts, fonts1, fonts2, fonts3, fonts4
  37.  
  38.   -- The following is to illustrate how popup menus can
  39.   -- act like drop down menus.  The trick is simply to
  40.   -- position the top, left of the menu at the bottom,
  41.   -- left of the button/menu title.
  42.  
  43.   get rect of the target
  44.   put first item of it + first item of loc of card window + one into mouseH
  45.   put fourth item of it + second item of loc of card window into mouseV
  46.  
  47.   do "get PopUpMenu( fonts" & disabled & ", empty, h, v )"
  48.  
  49.   if it is not empty then
  50.     put it into disabled
  51.     set the textFont of the target to item disabled of fonts
  52.   end if
  53. end doPopUp
  54.  
  55.  
  56. -- part 1 (button)
  57. -- low flags: 00
  58. -- high flags: A004
  59. -- rect: left=197 top=153 right=175 bottom=297
  60. -- title width / last selected line: 0
  61. -- icon id / first selected line: 0 / 0
  62. -- text alignment: 1
  63. -- font id: 0
  64. -- text size: 12
  65. -- style flags: 0
  66. -- line height: 16
  67. -- part name: Example
  68. ----- HyperTalk script -----
  69. on mouseDown
  70.   doPopUp
  71. end mouseDown
  72.  
  73.  
  74. -- part contents for background part 10
  75. ----- text -----
  76. Disabled Items
  77.  
  78. To disable an Items prefix the itemΓÇÖs  text with an open parentheses.  An item of the form ΓÇ£(-ΓÇ¥  produces a diabled line.
  79.  
  80.  
  81.  
  82.  
  83.  
  84.